﻿using Ledict.Core.Data;
using Ledict.Utility.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ledict.ConditionExtract.Common
{
   public class DataBaseHelper
    {
        /// <summary>
        /// 获取数据库链接
        /// </summary>
        /// <param name="typeName">表名</param>
        /// <returns></returns>
        public Database GetDataBaseType(string typeName)
        {
            Database oBase = DatabaseFactory.CreateDatabase("JudgeDoc");
            switch (typeName)
            //默认采用160的库链接
            {
                case "JudgeDoc":
                    switch (ConfigHelper.AppSettings("Version"))
                    {
                        case "160":
                            oBase = DatabaseFactory.CreateDatabase("JudgeDoc");
                            break;
                        case "12":
                            oBase = DatabaseFactory.CreateDatabase("JudgeDoc12");
                            break;
                    }
                    break;
            }
            
            return oBase;
        }

    }
}
